#ifndef __SHAPE_H_
#define __SHAPE_H_

#include <glib-2.0/glib.h>
#include <libxml/parser.h>
#include <libxml/tree.h>

#define SHAPE_TYPE_ARROW_GENERIC	1
#define SHAPE_TYPE_PATH	2

struct shape_s {
	int shape_type;
	char filename[64];
	char ID[32];
	double w, h;
	double x, y;
	GList *d;
	char *text;
	char fill[8];
	char stroke[8];
	int line_width;

	struct shape_s *conn_shape;
	int conn_type;
	double translate_x, translate_y;
};

typedef struct shape_s shape_t;

typedef struct {
	int shape_type;
	shape_t *from, *to;
} shape_conn_t;

GList *shape_library;

void
shape_find_xml_shape(xmlNode * a_node, xmlNode **xml_shape);

inline void
get_coords_from_string(char *str,
					   double *a,
					   double *b);

void
shape_load_dir(char *path);

int
shape_load_defs_from_file(shape_t *shape,
						  char *filename_defs);


shape_t *
shape_load_from_file(char *filename);

void
shape_set_scale(shape_t *shape,
			    double x,
			    double y,
				double w,
				double h);

void
shape_set_text(shape_t *shape,
			   char *text);

void
shape_add_to_library(shape_t *shape);

void
shape_change_width(shape_t *shape,
				   double width);

void
shape_change_text(shape_t *shape,
				  char *text);

#endif

